package com.knowledgepoint.study.service;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import com.knowledgepoint.study.model.entity.KnowledgePointArticle;

import java.util.List;

/**
 * 知识点文章 Service 接口
 */
public interface KnowledgePointArticleService extends IService<KnowledgePointArticle> {
    
    /**
     * 根据分类ID获取文章列表
     */
    List<KnowledgePointArticle> listByCategoryId(Integer categoryOneId, Integer categoryTwoId);
    
    /**
     * 分页查询
     */
    <P extends IPage<KnowledgePointArticle>> P page(P page, Wrapper<KnowledgePointArticle> queryWrapper);
    
    /**
     * 根据ID获取文章详情
     */
    KnowledgePointArticle getDetailById(Integer id);
    
    /**
     * 新增文章
     */
    boolean add(KnowledgePointArticle article);
    
    /**
     * 新增文章并返回文章ID
     */
    Integer addAndReturnId(KnowledgePointArticle article);
    
    /**
     * 更新文章
     */
    boolean update(KnowledgePointArticle article);
    
    /**
     * 删除文章
     */
    boolean removeById(Integer id);
    
    /**
     * 增加文章查看次数
     */
    boolean incrementViewCount(Integer id);
    
    /**
     * 增加文章使用次数
     */
    boolean incrementUseCount(Integer id);
    
    /**
     * 搜索文章
     */
    List<KnowledgePointArticle> search(String keyword);
}
